package com.atguigu.spzx.model.exception;

import com.atguigu.spzx.model.vo.common.ResultCodeEnum;
import lombok.Data;

/**
 * @author LT
 * @create 2024-03-08-18:51
 */
@Data
public class GuiguException extends RuntimeException{

    private Integer code;
    private String message;

    private Throwable e;

    private ResultCodeEnum resultCodeEnum;

    public GuiguException(String message, Throwable e,  Integer code, ResultCodeEnum resultCodeEnum) {
        this.code = code;
        this.message = message;
        this.e = e;
        this.resultCodeEnum = resultCodeEnum;
    }

    public GuiguException(Throwable e,  Integer code, String message) {
        this.code = code;
        this.message = message;
        this.e = e;
    }
    public GuiguException(ResultCodeEnum resultCodeEnum,Throwable e) {
        this.code = resultCodeEnum.getCode();
        this.message = resultCodeEnum.getMessage();
        this.e = e;
    }
    public GuiguException(ResultCodeEnum resultCodeEnum) {
        this.code = resultCodeEnum.getCode();
        this.message = resultCodeEnum.getMessage();
        this.e = null;
    }
}
